package cn.xxluckey;

import cn.xxluckey.core.SessionManager;

public class TestLoginStatus {
    public static void main(String[] args) {
        SessionManager sessionManager = new SessionManager();

        String chargerId = "charger_001"; // 充电桩唯一标识

        // 模拟登录
        sessionManager.login(chargerId);
        System.out.println("充电桩登录，序列号重置为 0");

        // 模拟发送数据包
        int sequenceNumber1 = sessionManager.getAndIncrementSequenceNumber(chargerId);
        System.out.println("发送数据包，序列号: " + sequenceNumber1);

        int sequenceNumber2 = sessionManager.getAndIncrementSequenceNumber(chargerId);
        System.out.println("发送数据包，序列号: " + sequenceNumber2);

        // 模拟断开连接
        sessionManager.logout(chargerId);
        System.out.println("充电桩断开连接，序列号重置为 0");

        // 模拟重新登录
        sessionManager.login(chargerId);
        int sequenceNumber3 = sessionManager.getAndIncrementSequenceNumber(chargerId);
        System.out.println("重新登录后发送数据包，序列号: " + sequenceNumber3);
    }
}
